package com.tdtxdcxm.ruralcommunity.appruntime;


import com.tdtxdcxm.ruralcommunity.ResourceTable;
import com.tdtxdcxm.ruralcommunity.items.LCArryListContentItem;
import com.tdtxdcxm.ruralcommunity.items.LCArryListNormalItem;
import com.tdtxdcxm.ruralcommunity.providers.LCProviderForContent;
import com.tdtxdcxm.ruralcommunity.providers.LCProviderForNormal;
import com.tdtxdcxm.ruralcommunity.providers.PSProvider;
import ohos.aafwk.ability.AbilitySlice;
import ohos.agp.components.DirectionalLayout;
import ohos.agp.components.LayoutScatter;
import ohos.agp.components.webengine.WebView;

import java.util.ArrayList;

public class DataCenterControl {
    //这里是数据指挥中心，程序内软数据总线
    private DataCenterControl(){}

    public static String messageNoticeUrlString = "https://www.gitee.com/";//消息——通知所加载的html网页地址
    public static String serverIpWithPort = "http:127.0.0.1:8000/";//服务器地址,写上自己服务器的公网IP+端口号

    public static WebView webView = null;

    public static String userName = "";
    public static String age = "";
    public static String gender = "";
    public static String followsum = "";
    public static String fanssum = "";
    public static String readvalue = "";

    public static final String[] fields = {"艺","衣","食","住","行","学","文"};

    //首页-中间区域-pageslider每一页的子布局数据源列表
    public static final ArrayList<DirectionalLayout> firstcenter_pageslist = new ArrayList<>();

    //领域-中间区域-pageslider每一页的子布局数据源列表
    public static final ArrayList<DirectionalLayout> secondcenter_pageslist = new ArrayList<>();

    //消息-中间区域-pageslider每一页的子布局数据源列表
    public static final ArrayList<DirectionalLayout> fourthcenter_pageslist = new ArrayList<>();

    public static final ArrayList<LCArryListContentItem> worlddt_listcontainer_list = new ArrayList<>();
    public static final ArrayList<LCArryListContentItem> worldxm_listcontainer_list = new ArrayList<>();
    public static final ArrayList<LCArryListContentItem> worldwz_listcontainer_list = new ArrayList<>();

    public static final ArrayList<LCArryListContentItem> art_listcontainer_list = new ArrayList<>();
    public static final ArrayList<LCArryListContentItem> clothe_listcontainer_list = new ArrayList<>();
    public static final ArrayList<LCArryListContentItem> food_listcontainer_list = new ArrayList<>();
    public static final ArrayList<LCArryListContentItem> house_listcontainer_list = new ArrayList<>();
    public static final ArrayList<LCArryListContentItem> traffic_listcontainer_list = new ArrayList<>();
    public static final ArrayList<LCArryListContentItem> study_listcontainer_list = new ArrayList<>();
    public static final ArrayList<LCArryListContentItem> culture_listcontainer_list = new ArrayList<>();

    public static final ArrayList<LCArryListNormalItem> messageagree_listcontainer_list = new ArrayList<>();
    public static final ArrayList<LCArryListNormalItem> messagediscuss_listcontainer_list = new ArrayList<>();
    public static final ArrayList<LCArryListNormalItem> messagecollect_listcontainer_list = new ArrayList<>();

    public static final ArrayList<LCArryListNormalItem> follow_listcontainer_list = new ArrayList<>();
    public static final ArrayList<LCArryListNormalItem> fans_listcontainer_list = new ArrayList<>();

    public static final ArrayList<LCArryListNormalItem> discuss_listcontainer_list = new ArrayList<>();

    public static final ArrayList<LCArryListNormalItem> people_listcontainer_list = new ArrayList<>();

    public static final ArrayList<LCArryListContentItem> userdt_listcontainer_list = new ArrayList<>();
    public static final ArrayList<LCArryListContentItem> userxm_listcontainer_list = new ArrayList<>();
    public static final ArrayList<LCArryListContentItem> userwz_listcontainer_list = new ArrayList<>();
    public static final ArrayList<LCArryListContentItem> usercollect_listcontainer_list = new ArrayList<>();


    public static LCProviderForContent worldDtListContainerProvider = null;
    public static LCProviderForContent worldXmListContainerProvider = null;
    public static LCProviderForContent worldWzListContainerProvider = null;

    public static LCProviderForContent artListContainerProvider = null;
    public static LCProviderForContent clotheListContainerProvider = null;
    public static LCProviderForContent foodListContainerProvider = null;
    public static LCProviderForContent houseListContainerProvider = null;
    public static LCProviderForContent trafficListContainerProvider = null;
    public static LCProviderForContent studyListContainerProvider = null;
    public static LCProviderForContent cultureListContainerProvider = null;

    public static LCProviderForNormal messageAgreeListContainerProvider = null;
    public static LCProviderForNormal messageDiscussListContainerProvider = null;
    public static LCProviderForNormal messageCollectListContainerProvider = null;

    public static LCProviderForNormal followAndFanaListListContainerProvider = null;


    public static LCProviderForNormal discussListContainerProvider = null;

    public static LCProviderForNormal peopleListContainerProvider = null;

    public static LCProviderForContent userDtListContainerProvider = null;
    public static LCProviderForContent userXmListContainerProvider = null;
    public static LCProviderForContent userWzListContainerProvider = null;
    public static LCProviderForContent userCollectListContainerProvider = null;

    public static PSProvider firstcenter_pgSliderProvider = null;
    public static PSProvider secondcenter_pgSliderProvider = null;
    public static PSProvider fourthcenter_pgSliderProvider = null;


    public static void addDataToPagesList(AbilitySlice abilitySlice,int n,int typeN){
        switch (typeN) {
            case 0:
                firstcenter_pageslist.clear();
                for (int i = 0; i < n; i++) {
                    DirectionalLayout directionalLayout = (DirectionalLayout) LayoutScatter
                                                        .getInstance(abilitySlice.getContext())
                                                        .parse(ResourceTable.Layout_pageslider_item_listcontainer,null,false);
                    firstcenter_pageslist.add(directionalLayout);
                }
                break;
            case 1:
                secondcenter_pageslist.clear();
                for (int i = 0; i < n; i++) {
                    DirectionalLayout directionalLayout = (DirectionalLayout) LayoutScatter
                                                        .getInstance(abilitySlice.getContext())
                                                        .parse(ResourceTable.Layout_pageslider_item_listcontainer,null,false);
                    secondcenter_pageslist.add(directionalLayout);
                }
                break;
            case 2:
                break;
            case 3:
                fourthcenter_pageslist.clear();
                for (int i = 0; i < n; i++) {
                    if(i == 0){
                        DirectionalLayout directionalLayout = (DirectionalLayout) LayoutScatter
                                                            .getInstance(abilitySlice.getContext())
                                                            .parse(ResourceTable.Layout_pageslider_item_webview,null,false);
                        fourthcenter_pageslist.add(directionalLayout);
                        continue;
                    }
                    DirectionalLayout directionalLayout = (DirectionalLayout) LayoutScatter
                                                        .getInstance(abilitySlice.getContext())
                                                        .parse(ResourceTable.Layout_pageslider_item_listcontainer,null,false);
                    fourthcenter_pageslist.add(directionalLayout);
                }
                break;
            default:
                break;
        }

    }

}


